//
//  EMMAnalysisTwoCell.m
//  EMMApp
//
//  Created by Mac on 16/7/11.
//  Copyright © 2016年 YiXun. All rights reserved.
//

#import "EMMAnalysisTwoCell.h"
#import "DVLineChartView.h"

@interface EMMAnalysisTwoCell ()<DVLineChartViewDelegate>
{
    NSIndexPath *path;
//    UUChart *chartView;
    NSMutableArray *xArr;
    NSMutableArray*oArr;
}
@end
@implementation EMMAnalysisTwoCell


- (void)initWithXNumArr:(NSMutableArray *)xNumArr oneNumArr:(NSMutableArray *)oneNumArr indexPath:(NSIndexPath *)indexPath{
    xArr = xNumArr;
    oArr = oneNumArr;
    [self showDVLine];
}
- (void)showDVLine{
    
    DVLineChartView *ccc = [[DVLineChartView alloc] init];
    [self addSubview:ccc];
    
    ccc.yAxisViewWidth = 52;
    
    CGFloat maxValue = [[xArr valueForKeyPath:@"@max.floatValue"] floatValue];
    ccc.numberOfYAxisElements = maxValue;
    
    ccc.delegate = self;
    ccc.pointUserInteractionEnabled = NO;
    
    ccc.numberOfYAxisElements = 5;
    
    ccc.yAxisMaxValue = MAX(maxValue, 5);
    
    ccc.pointGap = 80;
    
    ccc.showSeparate = YES;
    ccc.separateColor = [UIColor blackColor];
    ccc.textFont = [UIFont systemFontOfSize:8];
    
    ccc.textColor = [UIColor blackColor];
    ccc.backColor = [UIColor whiteColor];
    ccc.axisColor = [UIColor colorFromHexCode:@"#e4e4e4"];
    ccc.separateColor = [UIColor colorFromHexCode:@"#e4e4e4"];
    
    ccc.xAxisTitleArray = oArr;
    
    
    ccc.frame = CGRectMake(0, 40, EMM_WIDTH - 20, 300);
    
    
    
    DVPlot *plot = [[DVPlot alloc] init];
    plot.pointArray = xArr;
    
    plot.lineColor = [UIColor colorFromHexCode:@"#4cb84b"];
    plot.pointColor = [UIColor colorFromHexCode:@"#4cb84b"];
    plot.chartViewFill = NO;
    plot.withPoint = YES;
    plot.buttonColor = [UIColor colorFromHexCode:@"#4cb84b"];
    [ccc addPlot:plot];
    [ccc draw];
}


@end
